<template>
	<view class="content">
		<view class="top-tips flexal">
			<view class="tips-frame flexcen">i</view>
			<view style="margin-left: 17rpx;">主持人正在共享投票结果</view>
		</view>
		<view class="frame-top">
			<view class="top-title flexal">
				<image src="/static/metting/voteIcon.png" style="width: 36rpx; height: 32rpx;"></image>
				<view style="margin-left: 18rpx;">投票主题名称1</view>
			</view>
			<view class="top-conent">
				投票描述文字内容文字内容文字内容文字内容内容内容内容内容内容内容内容内容内容内容内容。
			</view>
			<view class="top-status flexal">
				<view style="margin-right: 20rpx;" v-if="start">0个人已投</view>
				<view>匿名</view>
				<view style="color: #2BA471;margin-left: 20rpx;" v-if="start">进行中</view>
				<view style="color: #D54941;margin-left: 20rpx;" v-else>未开始</view>
			</view>
		</view>
		
		<view class="frame-content">
			<view class="content-item" v-for="(item,index) in list" :key="index">
				<view style="font-weight: 400;font-size: 30rpx;color: #000000;">{{index+1}}   {{item.name}}</view>
				<view  v-for="(items,indexs) in item.child" :key="indexs">
				<view class="flexal" style="margin-top: 45rpx;">
					<view style="flex: 1;" class="content-text">{{items.name}}</view>
					<view class="content-text">{{items.num}}票 {{items.percent}}%</view>
				</view>
				<u-line-progress active-color="#2979ff"  inactive-color="#b5cdf4" :percent="0" :height="15" 
				:show-percent="false" style="margin-top: 25rpx;"></u-line-progress>
				</view>
			</view>
		</view>
		<view style="height: 149rpx;" v-if="type"></view>
		
		<view class="frame-buttom flexal" v-if="type">
			<view class="button flexcen" style="background: #FFFFFF;border: 2rpx solid #D54941;color: #D54941;margin-left: 32rpx;"
			:style="{'width':attend&&start? '331rpx':'212rpx'}"
			>删除</view>
			<view class="button flexcen" style="background: #FFFFFF;border: 2rpx solid #0052D9;color: #0052D9;" v-if="start&&!attend"
			 @click="go('/pages6/metting/attendVote')">参与投票</view>
			<view class="button flexcen" style="background: #FFFFFF;border: 2rpx solid #0052D9;color: #0052D9;" v-if="!start">编辑</view>
			<view class="button flexcen" v-if="start" :style="{'width':attend? '331rpx':'212rpx'}"  @click="showPop = !showPop">终止投票</view>
			<view class="button flexcen" v-else @click="startVote">发起投票</view>
		</view>
		
		<!-- 是否终止投票 -->
		<u-popup v-model="showPop" mode="center" border-radius="24">
				<view class="Pop-frame flexcolumnalign">
					<view class="title">是否终止投票</view>
					<view class="flexal" style="margin-top: 30rpx;">
					<!-- <u-checkbox @change="checkboxChange" :name="'all'" v-model="checked" :shape="'circle'" >允许成员自我解除静音</u-checkbox> -->
					<view class="text" style="width: 480rpx;">投票终止后参会者将无法继续投票或 修改投票。是否继续？</view>
					</view>
					<view style="padding: 32rpx 0rpx;">
					<u-line color="#3C3C43" length="622rpx"/>
					</view>
					<view style="display: flex;width: 100%;">
						<view class="button" @click="showPop = false">取消</view>
						<view class="line"></view>
						<view class="button" style="color: #0052D9;" @click="showPop = false">终止投票</view>
					</view>
				</view>
		</u-popup>
		<!-- 电话提示滑动快 -->
		<movablearea1 :movaheight="movaheightAll" v-if="movableareaShow" @editMovaheightAll="editMovaheightAll" :movaTop="movaTopAll"></movablearea1>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				start:false,				//是否开始投票
				attend:true,				//是否已参与投票
				showPop:false,				//删除提示弹窗
				type:1,						//是否显示底部操作栏
				list:[
					{
						name:'问题名称名称名称',
						child:[
							{
								name:'选项1',
								num:0,
								percent:0,
							},{
								name:'选项2',
								num:0,
								percent:0,
							},{
								name:'选项3',
								num:0,
								percent:0,
							},
						]
					},{
						name:'问题名称名称名称',
						child:[
							{
								name:'选项1',
								num:0,
								percent:0,
							},{
								name:'选项2',
								num:0,
								percent:0,
							},{
								name:'选项3',
								num:0,
								percent:0,
							},
						]
					},{
						name:'问题名称名称名称',
						child:[
							{
								name:'选项1',
								num:0,
								percent:0,
							},{
								name:'选项2',
								num:0,
								percent:0,
							},{
								name:'选项3',
								num:0,
								percent:0,
							},
						]
					},
				]
			}
		},
		onLoad(option) {
			console.log('option',option)
			if('type' in option){
				this.type = parseInt(option.type) 
				console.log('我进来了',this.type)
			}
		},
		
		methods: {
			
			// 发起投票
			startVote(){
				this.empty = false
				uni.setNavigationBarTitle({
					title:'投票进行中'
				});
				this.start = !this.start
			},
		}
	}
</script>

<style lang="less">
	.content{
		background: #F2F1F6;
	}
	.frame-top{
		padding: 44rpx 32rpx;
		background: #fff;
	}
	.top-title{
		font-weight: 500;
		font-size: 30rpx;
		color: #000000;
	}
	.top-conent{
		margin-top: 34rpx;
		font-weight: 400;
		font-size: 26rpx;
		color: #000000;
	}
	.top-status{
		margin-top: 32rpx;
		font-weight: 400;
		font-size: 26rpx;
		color: #858A99;
	}
	.frame-content{
		background: #fff;
		margin-top: 16rpx;
		padding: 44rpx 32rpx;
		
		.content-item{
			margin-bottom: 50rpx;
		}
		
		.content-text{
			font-weight: 400;
			font-size: 26rpx;
			color: #333333;
		}
	}
	
	.frame-buttom{
		display: flex;
		position: fixed;
		bottom: 0rpx;
		width: 750rpx;
		height: 149rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 8rpx 32rpx 1rpx rgba(9,4,114,0.1);
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		.button{
			margin-left: 25rpx;
			width: 212rpx;
			height: 89rpx;
			background: #0052D9;
			border-radius: 24rpx 24rpx 24rpx 24rpx;
			font-weight: normal;
			font-size: 32rpx;
			color: #FFFFFF;
		}
	}
	
	.Pop-frame{
		width: 600rpx;
		height: 312rpx;
		background: #FFFFFF;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		.title{
			margin-top: 38rpx;
			font-weight: 500;
			font-size: 30rpx;
			color: #333333;
		}
		.text{
			text-align: center;
			font-weight: 400;
			font-size: 30rpx;
			color: #333333;
		}
		.button{
			width: 50%;
			font-weight: 400;
			font-size: 30rpx;
			color: #4A4A4A;
			text-align: center;
		}
		.line{
			margin-top: -32rpx;
			width: 1rpx;
			height: 97rpx;
			background: rgba(60,60,67,0.36);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
		}
	}
	
	.top-tips{
		padding: 0rpx 32rpx;
		width: 750rpx;
		height: 56rpx;
		background: #F2F3FF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		font-weight: 400;
		font-size: 26rpx;
		color: #366EF4;
		.tips-frame{
			width: 29rpx;
			height: 29rpx;
			background: #366EF4;
			border-radius: 50%;
			font-weight: 700;
			font-size: 20rpx;
			color: #fff;
		}
	}
	
</style>
